<template>
    <div class="parent">
      <child :message="msg" @emitMsgToParent="showMsgFromChild"></child>
      <p>子组件传递的数据是{{childMsg}}</p>
    </div>
</template>

<script>
    import child from './child';
    export default {
      name: "parent",
      data(){
          return {
            msg:"hello world",
            childMsg:""
          }
      },
      components:{
        child
      },
      methods:{
        showMsgFromChild(msg){
          this.childMsg=msg;
        }
      }
    }
</script>

<style scoped>

</style>
